# -*- coding: utf-8 -*-
'''
Created on 2012-4-19

@author: deadblue
'''
from cn._2dland import model
from google.appengine.ext import webapp
import page
import logging

class LogHandler(webapp.RequestHandler):
    def get(self):
        self.redirect('/log/1', True)

class LogListHandler(webapp.RequestHandler):
    def get(self, pno):
        pno = int(pno)

        # 查询30条记录
        limit = 30
        offset = limit * (pno - 1)
        logging.debug('%d, %d' % (offset, limit))
        logs = model.picklog.gql('ORDER BY time DESC LIMIT %d,%d' % (offset, limit))

        # 显示
        vars = {'title': u'领取记录 - 第 %d 页' % pno, 'logs': logs}
        pg = page.Page('log.html')
        pg.write(self.response.out, vars)
        
        